package test1.shapes;

public class Triangle extends AbstractShape{
    Point pointA;
    Point pointB;
    Point pointC;
    public double a,b,c;
    public Triangle()
    {
        pointA=new Point(-1,0);
        pointB=new Point(0,1);
        pointC=new Point(0,1);
        a=pointA.distanceTo(pointB);
        b=pointB.distanceTo(pointC);
        c=pointC.distanceTo(pointA);
    }

    public double getArea() {

        double p=(a+b+c)/2;
        if(a+b<c || a+c<b || b+c<a)
        {
            System.out.println("");
            return 0;
        }
        else
        {
            double s=p*(p-a)*(p-b)*(p-c);
            return Math.sqrt(s);
        }
    }
    public double getPrim() {

        return a+b+c;
    }
}